import 'package:xws/helpers/as_t.dart';

/// 通用响应结果
class ResObj {
  ResObj.fromJson(Map<String, dynamic> d) {
    success = asT<bool>(d['code'] == 200);
    message = asNullT<String>(d['message']) ?? '网络错误';
    data = d['data'];
  }

  late bool success;
  late String message;
  late dynamic data;

  @override
  String toString() {
    return <String, dynamic>{
      'success': success,
      'message': message,
      'data': data,
    }.toString();
  }
}
